package com.kamm.springbootflower.service;

import com.github.pagehelper.PageHelper;
import com.kamm.springbootflower.dao.FlowerMapper;
import com.kamm.springbootflower.domain.Flower;
import com.kamm.springbootflower.domain.FlowerTb;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FlowerServiceimpl implements  FlowerService{
    @Resource
    FlowerMapper flowerMapper;

    @Override
    public int deleteByPrimaryKey(Integer fId) {
        return flowerMapper.deleteByPrimaryKey(fId);
    }

    @Override
    public Flower selectByPrimaryKey(Integer fId) {
        return flowerMapper.selectByPrimaryKey(fId);
    }

    @Override
    public int insert(Flower record) {
        return flowerMapper.insert(record);
    }

    @Override
    public int updateByPrimaryKeySelective(Flower record) {
        return flowerMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Flower record) {
        return flowerMapper.updateByPrimaryKey(record);
    }

    @Override
    public int insertSelective(Flower record) {
        return flowerMapper.insertSelective(record);
    }

    @Override
    public int count(Flower flower) {
        return flowerMapper.count(flower);
    }

    @Override
    public List<Flower> findAll(Flower flower, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Flower> list=flowerMapper.findAll(flower);
        if(list.size()>0&&list!=null){
            return list;
        }
        return null;
    }


    @Override
    public int deleteAll(String[] ids) {
        if(ids!=null&&ids.length>0){
            return flowerMapper.deleteAll(ids);
        }
        return ' ';
    }


    @Override
    public List<Flower> findAll( Flower flower) {
        return flowerMapper.findAll(flower);
    }

    @Override
    public int delete(String[] ids) {
        return flowerMapper.delete(ids);
    }

    @Override
    public int add2(List<FlowerTb> list) {
        return flowerMapper.add2(list);
    }

    @Override
    public List<Flower> getTb() {
        return flowerMapper.getTb();
    }

    @Override
    public int deleteTbId(Integer fId, Integer ftId) {
        return flowerMapper.deleteTbId(fId,ftId);
    }

    @Override
    public int addType(FlowerTb flowerTb) {
        return flowerMapper.addType(flowerTb);
    }




    @Override
    public Flower findById(Integer fId) {
        return flowerMapper.findById(fId);
    }

    @Override
    public int update(FlowerTb flowerTb) {
        return flowerMapper.update(flowerTb);
    }

    @Override
    public int deleteById(Integer id) {
        return flowerMapper.deleteById(id);
    }


}
